-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(update): refactored code to make it more readable #36
Conversation
local xPlayer = ESX.GetPlayerFromId(source) | ||
local timeNow = os.clock() | ||
|
||
if not xPlayer.job.name == 'taxi' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be ~=
end | ||
end) | ||
|
||
ESX.RegisterServerCallback("esx_taxijob:SpawnVehicle", function(source, cb, model , props) | ||
local xPlayer = ESX.GetPlayerFromId(source) | ||
|
||
if xPlayer.job.name ~= "taxi" then | ||
if not xPlayer.job.name == "taxi" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here use ~=
local xPlayer = ESX.GetPlayerFromId(source) | ||
|
||
if not xPlayer.job.name == 'taxi' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here ~=
-- is there enough in the society? | ||
if count > 0 and item.count >= count then | ||
-- can the player carry the said amount of x item? | ||
if xPlayer.canCarryItem(itemName, count) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
if not xPlayer.canCarryItem(itemName, count) then
return xPlayer.showNotification(TranslateCap('player_cannot_hold'))
end
-- rest of the code here
local item = inventory.getItem(itemName) | ||
|
||
-- is there enough in the society? | ||
if count > 0 and item.count >= count then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here should get rid of nestling
refactored code + removed math.randomseed since it wasn't getting used anywhere